<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
    <script>
        $(function(){
            var btn = document.getElementsByTagName("button")[0]
            btn.onclick = function(){
                var inp = document.getElementsByTagName("input")[0]
                var value = inp.value
                $("img").attr("src",value)
                // $("img").prop("src",value)
            }
        })
    </script>
</head>
<body>
    <input type="text" name="" id="">
    <button>切换图片</button>
    <!-- img[src=''] -->
    <img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" alt="">
</body>
</html>